﻿import com.dinmax.factorium.*

class FactoriumObjetivos
extends MovieClip 
implements FactoriumContent {
	
	private var nSlide:Number = 0;
	private var maxSlide:Number = 9;

	private var mcPantalla:MovieClip;
		
	public function onLoad():Void {
		FactoriumApp.getApp().setObjetivoContent(this);
		this.resetContent();
		if(FactoriumApp.getApp() == undefined){
			this.showContent();
			this.onMouseDown = function():Void {
				this.nextSlide();
			};
		}
		return;
	};

	public function prevSlide():Void {
		this.nSlide--;
		if(nSlide < 0) nSlide = 0;
		this.setLights();
		this.setContent();
		return;
	};
	public function nextSlide():Void{
		this.nSlide++;
		if(nSlide > maxSlide) nSlide = 0;
		this.setLights();
		this.setContent();
		return;
	};
	public function getSlide():Number{
		return nSlide;
	};
	public function setSlide(n:Number):Void{
		this.nSlide = n;
		this.setLights();
		this.setContent();
		return;
	};

	public function showContent():Void {
		this.resetContent();
		this.gotoAndPlay("showContent");
		return;
	};

	public function hideContent():Void {
		this.mcPantalla.mcContent.gotoAndStop("disabled");
		this.onEnterFrame=function():Void{
			if(this._currentframe == 1){
				delete this.onEnterFrame;
				FactoriumApp.getApp().unloadContent();
			} else {
				this.prevFrame();
			};
			return;
		};
		return;
	};

	private function setLights():Void {
		for(var i:Number = 0; i <= this.maxSlide; i++){
			this.mcPantalla["mcLuz"+i].setActive(i == this.nSlide);
		};
		return;
	};

	private function setContent():Void {
		this.mcPantalla.mcContent.gotoAndStop(this.nSlide+1);
		return;
	};
	private function resetContent():Void {
		nSlide = 0;
		this.setLights();
		this.setContent();
	}
	
} // fin de clase